<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link href="navs.css" rel="stylesheet" type="text/css">
<link href="mian_body.css" rel="stylesheet" type="text/css">
</head>

<body>
    
    <?php
        $id= isset($_GET['id'])? $_GET['id']: "";
    
        $conn=@mysql_connect("localhost","root","")  or die(mysql_error());
         mysql_query("SET NAMES UTF8");
         @mysql_select_db('guyueyan',$conn) or die(mysql_error());
                   
        $id_max_sel= "SELECT max(id) FROM user";
        $query = mysql_query($id_max_sel) or die(mysql_error());
        $id_max = mysql_fetch_row($query)[0];
        $user_id= mt_rand(1,$id_max); //随机获取一个用户id
    ?>
    <!--右侧悬浮窗口-->
<div id="pitch">
    <nav>
        <ul>
            <li>
                <a style="padding: 0px;" href="main.php?id=<?php echo $id?>">
                     <img src="../imagse/b.png" width="69" height="71" alt=""/>
                </a>
            </li>
            <li>
                <a style="padding: 0px;" href="UpImg-master/index.php?id=<?php echo $id?>">
                    <img src="../imagse/d.png" width="69" height="71" alt=""/>
                </a> 
            </li>
            <li>
                <a style="padding: 0px;" href="photo_bianji.php?id=<?php echo $id?>">
                <img src="../imagse/e.png" width="69" height="71" alt=""/>
                </a>
            </li>
            <li>
                <img src="../imagse/c.png" width="69" height="71" alt=""/>
                
            </li>
            <li>
                <img src="../imagse/a.png" width="69" height="71" alt=""/>
                
            </li>
        </ul>
    </nav>    
</div>
    
<!--导航栏-->
<div>
    <nav id="navs">
        <ul class="main">
        <div id="logo">
        <img src="../imagse/9a30607625e6c07da570bb2eb07ebdcc4b23c759.png" alt="" height="45" /> 
        </div>
            <li class="dropdown">
                <a href="#" class="dropbtn">首页</a>
                <ul class="dropdown-content"> <!--style="padding-left: 0px;">-->
                   <!--/* <li><a href="#">Home</a></li>
                    <li><a href="#">news</a></li>
                    <li><a href="#">contact</a></li><ol></ol>
                    <li><a href="#">about</a></li>*/-->
                </ul>
            </li>
            
            <li  class="dropdown">
                <a href="#" class="dropbtn">图库</a>
                <ul class="dropdown-content">
                    <li><a href="#">动漫</a></li>
                    <li><a href="#">插画</a></li>
                    <li><a href="#">风景</a></li>
                    <li><a href="#">其他</a></li>
                </ul>
            </li>
            
            <li class="dropdown">
                <a href="#" class="dropbtn">榜单</a>
                <ul class="dropdown-content">
                    <li><a href="#">今日</a></li>
                    <li><a href="#">本周</a></li>
                    <li><a href="#">本月</a></li>
                </ul>
            </li>
            <li class="dropdown">
                <a href="#" class="dropbtn">创作</a>
                <ul class="dropdown-content">
                    <li><a href="#">水彩画</a></li>
                    <li><a href="#">素描</a></li>
                    <li><a href="#">板画</a></li>
                    <li><a href="#">中国画</a></li>
                </ul>
                
                
            </li>
            <li class="dropdown">
                <a href="#" class="dropbtn">contact</a>
                <ul class="dropdown-content">
                    <li><a href="#">内容1</a></li>
                    <li><a href="#">内容2</a></li>
                    <li><a href="#">内容3</a></li>
                    <li><a href="#">内容4</a></li>
                </ul>
            </li>
            
            <?php
                //搭火车过来的用户id
                if($id!=""){
                    $aaa = "SELECT name FROM user WHERE id =$id";
                    $name_1 = mysql_fetch_row(mysql_query($aaa))[0];
                echo "<li class='dropdown' style='margin-left: 15%;z-index:99;height: 45px;;margin-top: 7px;'>
                        欢&nbsp;迎&nbsp;你<br>$name_1</li>";
                    
                echo "<li class='dropdown' style='z-index: 99;margin-top: 12px;margin-left: 0px;margin-right: -32px;'><a href='main.php' style='color: #000000;margin-left: -20px;font-size: 16px;font-family: initial;margin-top: -10px;''>退出登录</a>";
                }else{
                    ?>    
                 <li class="dropdown" style="margin-left: 18%;z-index:99;">
                    <a href="login.html" class="dropbtn">登录</a>
                </li>
                <li class="dropdown" style="margin-left: -25px;margin-right: -80px;z-index:99;">
                    <a href="enroll.html" class="dropbtn">注册</a></li>
            <?php } ?>
      
        </ul>
    </nav>
</div>

 <!--主体-->
<article id="whole">
<div id="entry">
    <div style="margin-bottom: 35px;">
       
            <div style="float: left;margin-left: 40px;">
             <input name="but" type=submit id="but" onClick="window.location.replace('main.php<?php if($id!='') echo "?id=$id";?>');" value="换一批">
            </div>
        
        <form action="photo_search.php" method="post">
            <div style="float: right;">
                <input name="user_id" type="hidden" id="user_id" value="<?php echo $id?>">
                <input name="str" type="text" id="str" placeholder="请输入查询的用户昵称">
                <input name="ss" type="submit" id="ss" value="搜索">
            </div>
        </form>
    </div>
    <ul id="masonry" class="slider">
    <?php
    $count =0;
    while($count<4){
        
        $user_id = ($user_id++)%$id_max+1;
        $cha_name = "SELECT name FROM user WHERE id =$user_id";
        $uesr_name = mysql_fetch_row(mysql_query($cha_name))[0];
         
        echo " <li class='block'>
            <div style='background-color: antiquewhite'>"; 
            //头像部分
        echo "<div class='blogger' style='background-color:#bfefff'>
                    <div class='pos-img'>
                     <img src='../imagse/61de.jpg' width='75px' height='75px' alt=''/> 
                    </div>
                    <a href='user_root.php?id=$user_id' style='text-align: center;font-size: 18px;color: rgba(0,0,0,.64);padding: 0px;' target='_blank'><h3>「{$uesr_name}」</h3></a>
                </div>"; 
            //图片展示外  标记02
        echo "<div class='blogger1'>
                    <h2 class='illust-title'>作品展示</h2>
               <ul class='illust-content'>";
                   //图片展示内
            
        $cha_photo = "SELECT id,name,url FROM pictures WHERE user_id=$user_id order by rand()";
        $zhanshi = mysql_query($cha_photo);
        $j=0;           
        
        while($j<4 && $as = mysql_fetch_row($zhanshi)){
            $photo_id = $as[0];
            $name = $as[1];
            $url = $as[2];
            //标记03                                单指图片id
            echo " <a href='mian_pgoto_xianshi.php?id=$photo_id' target='_blank' style='padding: 0px;'>
                    <li class='pix-card'>
                    <div class='illust'>
                        <div class='el-image'>"; 
            echo " <img src='$url?x-oss-process=image/resize,m_fill,w_450'  alt='' width='32' height='32' class='el-image__inner'/> ";

            //标记03
            echo "</div> </div>  </li> </a>";
            $j++;
            
        }
        
                   
        //标记02   
        echo "</ul> </div>";        
                   
        echo " </div> </li>"; 
        $count++;
    }
      
        
    ?>
      
    </ul>
</div>
</article>
    
</body>
</html>
